{% macro album_modify_modal(album) %}
<div class="modal fade" id="album_modify_modal" tabindex="-1" role="dialog" aria-labelledby="modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="album_modify_modal_label">修改属性</h4>
            </div>
            <div class="modal-body">

                <div class="form-group">
                    <label for="album_name_text" class="control-label">Name</label>
                    <input type="text" class="form-control" id="album_name_text" name="name" value="{{ album.name }}">
                </div>

                <div class="form-group">
                    <label for="album_note_text" class="control-label">Note</label>
                    <textarea class="form-control" id="album_note_text" name="note" rows="5">{{ album.note | default('',True) }}</textarea>
                </div>

                {% if album.label == "volume" %}
                <div class="form-group">
                    <label for="single_actress_select" class="control-label">Actress</label>
                    <select class="form-control" id="single_actress_select">
                        {% for actress in siteinfo.all_actresses %}
                        <option value="{{ actress.id }}" {% if album.actress_id == actress.id %}selected{% endif %} name="actress">{{actress.name}}&lt;span style='display:none'&gt;{{ actress.pinyin}}&lt;/span&gt;</option>
                        {% endfor %}
                    </select>
                </div>
                {% endif %}

                {% if album.label in ["tag", "album", "actress"] %}
                <div class="form-group">
                    <label for="album_name_text" class="control-label">Option Group</label>
                    <input type="text" class="form-control" id="album_meta_option_group" name="name" value="{{ album.meta.option_group | default('',True) }}">
                </div>
                {% endif %}

                <div class="form-group">
                    <label for="album_archive_chk" class="control-label">存档
                        <input type="checkbox" class="pic_info_chk" id="album_archive_chk" {% if album.meta.archived %}checked{% endif %}>
                    </label>
                </div>

                <div class="form-group">
                    <label for="cancel_cover_chk" class="control-label" >取消固定封面
                        <input type="checkbox" class="pic_info_chk" id="cancel_cover_chk">
                    </label>
                </div>

                <div class="form-group">
                    <label for="album_order_by" class="control-label">排序方式</label>
                    <div class="form-group" id="album_order_by">
                        <label class="col-sm-4 col-md-4 col-lg-4">
                            <input class="pic_info_chk" name="order_by" type="radio" value="note"
                            {% if album.meta.order_by == 'note' %}checked{% endif %}>
                            照片名称
                        </label>
                        <label class="col-sm-4 col-md-4 col-lg-4">
                            <input class="pic_info_chk" name="order_by" type="radio" value="album_time"
                            {% if album.meta.order_by == 'album_time' %}checked{% endif %}>
                            加入相册时间
                        </label>
                        <label class="col-sm-4 col-md-4 col-lg-4">
                            <input class="pic_info_chk" name="order_by" type="radio" value="pic_time"
                            {% if album.meta.order_by == 'pic_time' %}checked{% endif %}>
                            照片导入时间
                        </label>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <div class="pull-left"><input type="button" class="btn btn-danger btn-sm" id="delete_tag_album" value="删除"></div>
                <input type="button" class="btn btn-primary btn-sm" id="modify_album_btn" value="提交"/>
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">取消</span></button>
            </div>
        </div>
    </div>
</div>
{% endmacro %}


{% macro work_modal() %}
    <div class="modal fade" id="work_modal" tabindex="-1" role="dialog" aria-labelledby="modal">
        <div class="modal-dialog">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="modal-title">add work</h4>
                </div>

                <div class="modal-body">
                    <form id="add_work">
                        <div class="form-group">
                            <label for="work_title">标题</label>
                            <input type="text" class="form-control" id="work_title" name="work_title">
                        </div>
                        <div class="form-group">
                            <label for="work_content">内容</label>
                            <textarea id="work_content" class="form-control" rows="10" name="work_content"></textarea>
                        </div>
                        <div class="form-group">
                            <label for="work_priority">优先级</label>
                            <input type="number" class="form-control" id="work_priority" name="work_priority" value="1" min="1" max="3">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <input type="button" class="btn btn-primary btn-sm" id="add_work_submit" value="提交"/>
                    <button type="button" class="btn btn-default btn-sm" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">取消</span></button>
                </div>
            </div> <!-- modal-content end -->
        </div>
    </div><!-- modal end -->
{% endmacro %}


{% macro album_modal(siteinfo) %}
    <div class="modal fade" id="album_modal" tabindex="-1" role="dialog" aria-labelledby="modal">
        <div class="modal-dialog">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="modal-title">创建相册/标签/卷/模特</h4>
                </div>

                <div class="modal-body">
                    <form id="add_album" class="form-horizontal">
                        <div class="row">
                        <div class="form-group">
                            <div class="col-sm-12 col-xs-12">
                            <label for="name_album_or_tag" class="label-control col-sm-2 col-xs-3">名称</label>
                            <div class="col-sm-10 col-xs-9">
                                <input type="text" class="form-control input-sm" id="name_album_or_tag">
                            </div>
                        </div>
                            </div>

                        <div class="form-group">
                            <div class="col-sm-12 col-xs-12">
                            <label class="label-control col-sm-2 col-xs-3">类型</label>
                                <div class="col-sm-10 col-xs-9">
                                    <label class="radio-inline"><input type="radio" value="album" name="label">相册</label>
                                    <label class="radio-inline"><input type="radio" value="tag" name="label">标签</label>
                                    <label class="radio-inline"><input type="radio" value="volume" name="label">卷</label>
                                    <label class="radio-inline"><input type="radio" value="actress" name="label">模特</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group hidden" id="volume_only">
                            <div class="col-sm-12 col-xs-12">
                            <label class="label-control col-sm-2 col-xs-3">选择模特</label>
                            <div class="col-sm-10 col-xs-9">
                                <select class="form-control" id="single_actress_select">
                                    {% for actress in siteinfo.all_actresses %}
                                    <option value="{{actress.id}}">{{actress.name}}&lt;span style='display:none'&gt;{{ actress.pinyin}}&lt;/span&gt;</option>
                                    {%endfor%}
                                </select>
                            </div>
                            </div>
                        </div>
                            </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <input type="button" value="创建" class="btn btn-sm btn-primary" id="create_album_commit">
                    <button type="button" class="btn btn-default btn-sm" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">取消</span></button>
                </div>
            </div> <!-- modal-content end -->
        </div>
    </div><!-- modal end -->
{% endmacro %}


{% macro edit_setting(settings) %}
    <div class="modal fade" id="edit_setting" tabindex="-1" role="dialog" aria-labelledby="modal">
        <div class="modal-dialog">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="modal-title">Edit Setting</h4>
                </div>

                <div class="modal-body">
                    <table style="word-wrap: break-word; word-break: break-all;">
                        <tr>
                            <th width="35%">Label</th>
                            <th width="30%">desc</th>
                            <th width="25%">value</th>
                            <th width="10%">edit</th>
                        </tr>
                        {% for setting in settings %}
                        <tr>
                            <td>{{setting.label}}</td>
                            <td>{{setting.desc}}</td>
                            <td>
                                <input type="text" class="form-control input-sm" value="{{setting.value}}" id="setting_value_{{setting.id}}">
                            </td>
                            <td>
                                <input type="button" value="修改" class="btn btn-sm btn-primary" onclick="editSetting_btn({{setting.id}})">
                            </td>
                        </tr>
                        {% endfor %}
                    </table>
                </div>

                <hr />

                <div class="modal-header">
                    <h4 class="modal-title">Add New Setting</h4>
                </div>

                <div class="modal-body">
                    <form id="new_setting_form">
                        <div class="row">
                            <div class="col-sm-5">
                                <div class="form-group">
                                    <label for="new_setting_label">Label</label>
                                    <input type="text" class="form-control" id="new_setting_label" name="new_setting_label">
                                </div>
                            </div>
                            <div class="col-sm-5">
                                <div class="form-group">
                                    <label for="new_setting_desc">Desc</label>
                                    <input type="text" class="form-control" id="new_setting_desc" name="new_setting_desc">
                                </div>
                            </div>
                            <div class="col-sm-2">
                                <div class="form-group">
                                    <label for="new_setting_value">Value</label>
                                    <input type="text" class="form-control" id="new_setting_value" name="new_setting_value">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <input type="button" value="提交" class="btn btn-sm btn-primary" id="new_setting_commit">
                    <button type="button" class="btn btn-default btn-sm" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">取消</span></button>
                </div>

            </div> <!-- modal-content end -->
        </div>
    </div><!-- modal end -->
{% endmacro %}



{% macro picture_modal(siteinfo,pic) %}
    <div class="modal fade" id="pic_modal" tabindex="-1" role="dialog" aria-labelledby="modal">
        <div class="modal-dialog" style="width: auto">
            <div class="modal-content">

                <div class="modal-header">
                    <span class="pull-right" style="color:#cbcbcb">
                        <input type="button" class="btn btn-primary btn-md pic_modal_submit" value="提交"/> | <button type="button" class="btn btn-default btn-md" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">取消</span></button>
                    </span>
                    <h4 class="modal-title" id="exampleModalLabel">编辑相册/标签信息</h4>
                </div>

                <div class="modal-body row">
                    <div class="col-xs-12 col-sm-3">
                        <h5>模特</h5>
                        <div class="row">
                            <form class="form-inline" role="form">
                                <div class="form-group col-xs-6 col-sm-6">
                                    <input type="text" class="form-control input-sm" id="create_actress" disabled>
                                </div>
                                <div class="form-group col-xs-3 col-sm-3">
                                    <input type="button" class="btn btn-success btn-sm" id="create_actress_btn" value="添加" disabled>
                                </div>
                                <div class="form-group col-xs-3 col-sm-3">
                                    <button type="button" class="btn btn-info btn-sm" data-toggle="collapse" data-target="#actress_div">+/-</button>
                                </div>
                            </form>
                        </div>
                        <div class="row collapse" id="actress_div"></div>
                    </div>
                    <div class="col-xs-12 col-sm-3">
                        <h5>标签</h5>
                        <div class="row">
                            <form class="form-inline" role="form">
                                <div class="form-group col-xs-6 col-sm-6">
                                    <input type="text" class="form-control input-sm" id="create_tag">
                                </div>
                                <div class="form-group col-xs-3 col-sm-3">
                                    <input type="button" class="btn btn-success btn-sm" id="create_tag_btn" value="添加">
                                </div>
                                <div class="form-group col-xs-3 col-sm-3">
                                    <button type="button" class="btn btn-info btn-sm" data-toggle="collapse" data-target="#tag_div">+/-</button>
                                </div>
                            </form>
                        </div>
                        <div class="row collapse" id="tag_div"></div>
                    </div>
                    <div class="col-xs-12 col-sm-3">
                        <h5>卷</h5>
                        <div class="row">
                            <form class="form-inline" role="form">
                                <div class="form-group col-xs-6 col-sm-6">
                                    <input type="text" class="form-control input-sm" id="create_volume" disabled>
                                </div>
                                <div class="form-group col-xs-3 col-sm-3">
                                    <input type="button" class="btn btn-success btn-sm" id="create_volume_btn" value="添加" disabled>
                                </div>
                                <div class="form-group col-xs-3 col-sm-3">
                                    <button type="button" class="btn btn-info btn-sm" data-toggle="collapse" data-target="#volume_div">+/-</button>
                                </div>
                            </form>
                        </div>
                        <div class="row collapse" id="volume_div"></div>

                    </div>
                    <div class="col-xs-12 col-sm-3">
                        <h5>相册</h5>
                        <div class="row">
                            <form class="form-inline" role="form">
                                <div class="form-group col-xs-6 col-sm-6">
                                    <input type="text" class="form-control input-sm" id="create_album">
                                </div>
                                <div class="form-group col-xs-3 col-sm-3">
                                    <input type="button" class="btn btn-success btn-sm" id="create_album_btn" value="添加">
                                </div>
                                <div class="form-group col-xs-3 col-sm-3">
                                    <button type="button" class="btn btn-info btn-sm" data-toggle="collapse" data-target="#album_div">+/-</button>
                                </div>
                            </form>
                        </div>
                        <div class="row collapse" id="album_div"></div>

                </div><!-- modal-body end -->

                <div class="modal-footer">
                    <input type="button" class="btn btn-primary btn-md pic_modal_submit" value="提交"/> |<button type="button" class="btn btn-default btn-md" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">取消</span></button>
                </div>
            </div> <!-- modal-content end -->
        </div>
    </div><!-- modal end -->
{% endmacro %}